from django.db import models


# Create your models here.

class Classification_Shop(models.Model):
    id = models.AutoField(primary_key=True)
    class_id = models.IntegerField(verbose_name="类目", unique=True)
    class_name = models.CharField(max_length=255, verbose_name="类目名称", null=True)
    first_cid = models.IntegerField(verbose_name="一级类目", null=True)
    second_cid = models.IntegerField(verbose_name="二级类目", null=True)
    update_time = models.DateTimeField(auto_now=True, max_length=10, verbose_name="更新时间", db_index=True)
    create_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间", db_index=True)

    class Meta:
        verbose_name = "商品类目库"
        verbose_name_plural = "商品类目库"


class Toutiao_ShopItem(models.Model):
    id = models.AutoField(primary_key=True)
    shop_url = models.CharField(max_length=1024, verbose_name="商品链接", null=True)
    goods_id = models.CharField(max_length=32, unique=True, verbose_name="商品id")
    shop_eid = models.CharField(max_length=32, db_index=True, verbose_name="店铺eid", null=True)
    goods_name = models.CharField(max_length=512, verbose_name="商品名称", null=True)
    goods_price = models.FloatField(max_length=10, verbose_name="商品价格", null=True)
    cid = models.IntegerField(verbose_name="类目", null=True)
    first_cid = models.IntegerField(verbose_name="一级类目", null=True)
    second_cid = models.IntegerField(verbose_name="二级类目", null=True)
    img = models.CharField(max_length=512, verbose_name="主图", null=True)
    description = models.TextField(verbose_name="商品详情", null=True)
    sell_num = models.IntegerField(verbose_name="销量", null=True)
    good_count = models.CharField(max_length=32, verbose_name="好评数", null=True)
    mid_count = models.CharField(max_length=32, verbose_name="中评数", null=True)
    bad_count = models.CharField(max_length=32, verbose_name="差评数", null=True)
    appends_count = models.CharField(max_length=32, verbose_name="追平数", null=True)
    site_name = models.CharField(max_length=50, verbose_name="销售渠道")
    tips = models.CharField(max_length=500, verbose_name="备注", null=True)
    update_time = models.DateTimeField(auto_now=True, max_length=10, verbose_name="更新时间", db_index=True)
    create_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间", db_index=True)

    class Meta:
        verbose_name = "头条商品库"
        verbose_name_plural = "头条商品库"
